<template>
  <div class="app-container">
    <div class="filter-container">
      订单号:
      <el-input v-model="listQuery.oid" label="订单号" placeholder="订单号" style="width: 200px;" class="filter-item mring10"
        @keyup.enter.native="handleFilter" suffix-icon="el-icon-search" />
      <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter" size="small"> 搜索</el-button>
    </div>

    <el-table v-loading="listLoading" :data="list" fit stripe highlight-current-row
      style="width: 100%;margin-top: 1.125rem" row-key="id">
      <el-table-column label="订单号" prop="oid"></el-table-column>
      <el-table-column label="送货速度分数" prop="delivery_speed_mark"></el-table-column>
      <el-table-column label="配送员服务分数" prop="delivery_service_mark"></el-table-column>
      <el-table-column label="支付时间">
        <template slot-scope="{row}">
          {{ row.purchase_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
        </template>
      </el-table-column>
      <el-table-column label="评价时间" prop="create_time" align="center">
        <template slot-scope="{row}">
          {{ row.create_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
        </template>
      </el-table-column>
      <el-table-column label="是否自动好评" >
         <template slot-scope="{row}">
          {{ row.is_auto == 1 ? '是' : '否' }}
        </template>
      </el-table-column>
    </el-table>
    <pagination hide-on-single-page v-show="total > 0" :total="total" :page.sync="listQuery.page"
      :limit.sync="listQuery.size" @pagination="getList" />
  </div>
</template>
<script>
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination'
import { fetchList } from '@/api/order/comment'

export default {
  name: 'ComplexTable',
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      list: [],
      listLoading: false,
      total: 0,
      listQuery: {
        size: 10,
        page: 1
      },
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      fetchList(this.listQuery).then(response => {
        this.list = response.data.data
        this.total = response.data.total
        this.listLoading = false
      })
    },

    handleFilter() {
      this.listQuery.page = 1
      this.getList()
    },
  }
}

</script>
<style type="text/css">
.avatar,
.avatar-uploader-icon {
  width: 90px;
  height: 90px;
  padding: 1px;
  border: 1px solid #ccc;
  text-align: center;
  line-height: 90px;
}

.filter-container {
  background: #FFFFFF;
  padding: 0.625rem 1.125rem;
}

table td {
  font-size: 12px;
  color: #8c8c8c;
}

.goods-name {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 18px
}

.btn {
  padding: 0 10px;
  font-size: 12px;
}

.btn-pass {
  border-right: 1px solid #c0c4cc
}
.filter-container{font-size: 12px;}
.filter-item input[type='text'] {
  height: 32px;
  line-height: 32px;
  font-size: 12px;
}

.mring10 {
  margin-right: 10px;
}
</style>
